//##LICENSE##
/*
 * See License.txt in the source folder for the license.
 */
//##END_LICENSE##
package org.gidoo.owl2.backend;

import java.io.Serializable;
import java.util.List;
import java.util.Properties;

/**
 * Interface for a provider of dictionaries.
 * @author Thomas Krause
 */
public interface DictionaryProvider extends Serializable
{
  /**
   * Return proposed search-terms for given search. This can be used for an auto-suggest-like
   * functionality.
   * 
   * @param docID The database internal id of the xml document.
   * @param search The string the user searched for already.
   * @return Proposals.
   */
  public List<String> getMatchingSearchTerms(long docID, String search)
    throws DatabaseError;
  
  /**
   * Get a result for a specific search.
   * @param docID The document to search in.
   * @param search The search term.
   * @return A list of element IDs matching this search.
   */
  public List<Long> getSearchResult(long docID, String search)
    throws DatabaseError;
  
  /**
   * Constructor-like (re)-init function.
   * @param env The enviroment configuration properties.
   */
  public void init(Properties env)
    throws DatabaseError;
  
  /**
   * Get the IDs of the available documents in the database.
   * @return
   */
  public List<Long> getDocuments()
    throws DatabaseError;
  
  /** Get the document ID by name */
  public long getDocumentIDFromName(String name)
    throws DatabaseError;
  
  /** Get the document name by id */
  public String getDocumentNameFromID(long id)
    throws DatabaseError;
  
  /** 
   * Get the reconstructed XML source fragment by the element id 
   * @param elementID
   */
  public String getXMLSource(long elementID)
    throws DatabaseError;
}
